package cn.hairui.blog.service.impl;

import cn.hairui.blog.model.Album;
import cn.hairui.blog.model.AlbumImg;
import cn.hairui.blog.repository.AlbumRepository;
import cn.hairui.blog.service.AlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author lihairui
 * @version V1.0
 * @date: 2019/7/5 22:07
 */
@Service(value = "gallerysService")
public class AlbumServiceImpl implements AlbumService {

    @Autowired
    private AlbumRepository albumRepository;

    @Override
    public AlbumImg findLatestImg() {
        return albumRepository.findLatestImg();
    }

    @Override
    public List<Album> findGust() {
        return albumRepository.findGust();
    }

    @Override
    public List<Album> findManager(String username) {
        return albumRepository.findManager(username);
    }

    @Override
    public List<Album> list() {
        return albumRepository.list();
    }

    @Override
    public Integer countImg(Integer id) {
        return albumRepository.countImg(id);
    }

    @Override
    public Album find(int id) {
        return albumRepository.find(id);
    }

    @Override
    public List<AlbumImg> findImgsByAlbuId(int id) {
        return albumRepository.findImgsByAlbuId(id);
    }

    @Override
    public List<Map> listMgr() {
        return albumRepository.listMgr();
    }

    @Override
    public void updateIsShow(int id, String flag) {
        albumRepository.updateIsShow(id, flag);
    }

    @Override
    public List<Map> findImgsJsonByAlbuId(int id) {
        return albumRepository.findImgsJsonByAlbuId(id);
    }

    @Override
    public void add(Album album) {
        albumRepository.add(album);
    }

    @Override
    public void deleteById(int id) {
        albumRepository.deleteById(id);
    }
}
